package com.project_test.kun.travelling_1st.HomePage.category;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *  Created by Administrator on 16-10-17.
 */
public class HPHouseDetail implements Serializable {
   private List<mandate_HPHouseDetail> mandates;
    private List<facility_HPHouseDetail> facilitys;
    private List<Map<String,Object>> picLists;
    private int mId;
    private String mName;
    private String mIntro;
    private int mOwner_id;
    private int mRoom_type;
    private int mStatus;
    private int mHotel_type;
    private String mLng;
    private String mLat;
    private String mAddress_level1;
    private String mAddress_level2;
    private String mAddress_level3;
    private String mAddress_level4;
    private String mRoom_inner_intro;
    private String mTraffic_intro;
    private String mAround_village_intro;
    private String mUse_rule;
    private int mHid;
    private Object mIntro1;
    private Object mPrice_type;
    private int mPrice;
    private int mDeposit;
    private int mS_num;
    private int mBed_num;
    private Object mTags;
    private int mBed_size;
    private int mRoom_size;
    private int mSex_limit;
    private int mMax_person;
    private Object mS_sort;
    private int mBuy_type;
    private int mMin_book_days;
    private int mMax_book_days;
    private Object mLast_update;
    private Object mCurrent_status;
    private Object mMCurrent_status;
    private String mCheck_time;
    private String mOut_time;
    private int mRefund;
    private int mBedroom_num;
    private int mBathroom_num;
    private String mHotel_type_name;
    private String mRoom_type_name;
    private Object mAddress_level5;
    private String mOwner_name;
    private String mR_info_id;
    private String mR_info_title;
    private String mR_info_description;

    public void pashJson(JSONObject json) throws JSONException {
        mandates=new ArrayList<>();
        facilitys=new ArrayList<>();
        picLists=new ArrayList<>();
//        "id": "9886",
        mId = json.getInt("id");
//                "name": "十渡私人农家院",
        mName = json.getString("name");
//                "intro": "我喜欢的房客是爱交朋友爱玩喜欢生活。我的个人爱好是结交朋友。我的人生格言是生活多美好。我的房间最大的特色是田园风格地方宽敞有独立院子。我的拿手绝活是好客喜欢做饭。",
        mIntro = json.getString("intro");
//                "owner_id": "10613",
        mOwner_id = json.getInt("owner_id");
//                "room_type": "58",
        mRoom_type = json.getInt("room_type");
//                "status": "1",
        mStatus = json.getInt("status");
//                "hotel_type": "209",
        mHotel_type = json.getInt("hotel_type");
//                "lng": "116.14727",
        mLng = json.getString("lng");
//                "lat": "39.739913",
        mLat = json.getString("lat");
//                "address_level1": "中国",
        mAddress_level1 = json.getString("address_level1");
//                "address_level2": "北京市",
        mAddress_level2 = json.getString("address_level2");
//                "address_level3": "房山区",
        mAddress_level3 = json.getString("address_level3");
//                "address_level4": "十渡镇",
        mAddress_level4 = json.getString("address_level4");
//                "room_inner_intro": "卧室里面有空调 电视 卫生间 电视柜。从窗户外可以看到的景色有燕山山脉 开门见山的感觉。厨房里面有三门伊莱克斯冰箱 电饭锅 空气炸锅 烟机灶具 厨房用具 都有。客厅里面有大沙发 大茶几 大电视 大鱼缸。房间里的电器设施有有电视 空调。",
        mRoom_inner_intro = json.getString("room_inner_intro");
//                "traffic_intro": "从飞机场来的方式是开车最方便。从火车站来的方式是西客站坐火车到十渡站下车。周围的公交车站有836 小16路。出租车每公里的价钱是北京正常价格。从车站到家里的距离是0.5公里。",
        mTraffic_intro = json.getString("traffic_intro");
//                "around_village_intro": "楼宇及小区情况：\n楼宇的建成年代是2013年的房子。农家自己院子没有电梯。小区的环境情况是四周环山 开门见山 毫无遮挡 四周绿树成荫 天然氧吧。小区的绿化情况是环境回事让你回归大自然。小区的保安情况是有老人看家。\n外部周围情况：\n周围的饭馆有各种农家饭店需要开车去。周围的银行有农商银行。周围的超市有华冠超市开车12分钟到达。周围没有大型商场。周围的医院有八度医院。",
        mAround_village_intro = json.getString("around_village_intro");
//                "use_rule": "1、请携带有效身份证件办理入住。 2、客厅餐厅四个卧室都有空调。 3、请自带洗漱用具和拖鞋，免费提供烧烤工具。",
        mUse_rule = json.getString("use_rule");
//                "hid": "19124",
        mHid = json.getInt("hid");
//                "intro1": "",
        mIntro1 = json.opt("intro1");
//                "price_type": "",
        mPrice_type = json.opt("price_type");
//                "price": "798.00",
        mPrice = json.getInt("price");
//                "deposit": "500",
        mDeposit = json.getInt("deposit");
//                "s_num": "",
        mS_num = json.optInt("s_num");
//                "bed_num": "5",
        mBed_num = json.getInt("bed_num");
//                "tags": "",
        mTags = json.opt("tags");
//                "bed_size": "",
        mBed_size = json.optInt("bed_size");
//                "room_size": "",
        mRoom_size = json.optInt("room_size");
//                "sex_limit": "",
        mSex_limit = json.optInt("sex_limit");
//                "max_person": "8",
        mMax_person = json.getInt("max_person");
//                "s_sort": "",
        mS_sort = json.opt("s_sort");
//                "buy_type": "58",
        mBuy_type = json.optInt("buy_type");
//                "min_book_days": "1",
        mMin_book_days = json.optInt("min_book_days");
//                "max_book_days": "",
        mMax_book_days = json.optInt("max_book_days");
//                "last_update": "",
        mLast_update = json.opt("last_update");
//                "current_status": "",
        mMCurrent_status = json.opt("current_status");
//                "check_time": "14:00",
        mCheck_time = json.optString("check_time");
//                "out_time": "12:00",
        mOut_time = json.optString("out_time");
//                "refund": "96",
        mRefund = json.optInt("refund");
//                "bedroom_num": "4",
        mBedroom_num = json.getInt("bedroom_num");
//                "bathroom_num": "4",
        mBathroom_num = json.getInt("bathroom_num");
//                "hotel_type_name": "民居",
        mHotel_type_name = json.optString("hotel_type_name");
//                "room_type_name": "整套房屋",
        mRoom_type_name = json.optString("room_type_name");
//                "address_level5": "",
        mAddress_level5 = json.opt("address_level5");
//                "owner_name": "李燕军",
        mOwner_name = json.optString("owner_name");
        JSONArray mandate = json.getJSONArray("mandate");
        for (int i = 0; i < mandate.length(); i++) {
            JSONObject mandateJSONObject = mandate.getJSONObject(i);
            mandate_HPHouseDetail mandateHp=new mandate_HPHouseDetail();
            mandateHp.pashJson(mandateJSONObject);
            mandates.add(mandateHp);
        }

        JSONArray facility = json.getJSONArray("facility");
        for (int i = 0; i < facility.length(); i++) {
            facility_HPHouseDetail facilityHp=new facility_HPHouseDetail();
            JSONObject facilityJSONObject = facility.getJSONObject(i);
            facilityHp.pashJson(facilityJSONObject);
            facilitys.add(facilityHp);
        }
        JSONArray picList = json.getJSONArray("picList");
        for (int i = 0; i < picList.length(); i++) {
            Map<String,Object> pic=new HashMap<>();
            JSONObject picListJSONObject = picList.getJSONObject(i);
//            fid": "50060",
            pic.put("fid",picListJSONObject.optInt("fid"));
//            "pic_url": "http://img3.handybest.com/Uploads/Hotel/920/16/07/5794d50e57ead.jpeg!phone"
            pic.put("pic_url",picListJSONObject.getString("pic_url"));
            picLists.add(pic);
        }


        JSONObject refund_info = json.getJSONObject("refund_info");
//        id": "96",
        mR_info_id = refund_info.getString("id");
//        "title": "宽松退款政策",
        mR_info_title = refund_info.getString("title");
//                "description":
        mR_info_description = refund_info.getString("description");
    }

    public List<mandate_HPHouseDetail> getMandates() {
        return mandates;
    }

    public List<facility_HPHouseDetail> getFacilitys() {
        return facilitys;
    }

    public List<Map<String, Object>> getPicLists() {
        return picLists;
    }

    public int getId() {
        return mId;
    }

    public String getName() {
        return mName;
    }

    public String getIntro() {
        return mIntro;
    }

    public int getOwner_id() {
        return mOwner_id;
    }

    public int getRoom_type() {
        return mRoom_type;
    }

    public int getStatus() {
        return mStatus;
    }

    public int getHotel_type() {
        return mHotel_type;
    }

    public String getLng() {
        return mLng;
    }

    public String getLat() {
        return mLat;
    }

    public String getAddress_level1() {
        return mAddress_level1;
    }

    public String getAddress_level2() {
        return mAddress_level2;
    }

    public String getAddress_level3() {
        return mAddress_level3;
    }

    public String getAddress_level4() {
        return mAddress_level4;
    }

    public String getRoom_inner_intro() {
        return mRoom_inner_intro;
    }

    public String getTraffic_intro() {
        return mTraffic_intro;
    }

    public String getAround_village_intro() {
        return mAround_village_intro;
    }

    public String getUse_rule() {
        return mUse_rule;
    }

    public int getHid() {
        return mHid;
    }

    public Object getIntro1() {
        return mIntro1;
    }

    public Object getPrice_type() {
        return mPrice_type;
    }

    public int getPrice() {
        return mPrice;
    }

    public int getDeposit() {
        return mDeposit;
    }

    public int getS_num() {
        return mS_num;
    }

    public int getBed_num() {
        return mBed_num;
    }

    public Object getTags() {
        return mTags;
    }

    public int getBed_size() {
        return mBed_size;
    }

    public int getRoom_size() {
        return mRoom_size;
    }

    public int getSex_limit() {
        return mSex_limit;
    }

    public int getMax_person() {
        return mMax_person;
    }

    public Object getS_sort() {
        return mS_sort;
    }

    public int getBuy_type() {
        return mBuy_type;
    }

    public int getMin_book_days() {
        return mMin_book_days;
    }

    public int getMax_book_days() {
        return mMax_book_days;
    }

    public Object getLast_update() {
        return mLast_update;
    }

    public Object getCurrent_status() {
        return mCurrent_status;
    }

    public Object getMCurrent_status() {
        return mMCurrent_status;
    }

    public String getCheck_time() {
        return mCheck_time;
    }

    public String getOut_time() {
        return mOut_time;
    }

    public int getRefund() {
        return mRefund;
    }

    public int getBedroom_num() {
        return mBedroom_num;
    }

    public int getBathroom_num() {
        return mBathroom_num;
    }

    public String getHotel_type_name() {
        return mHotel_type_name;
    }

    public String getRoom_type_name() {
        return mRoom_type_name;
    }

    public Object getAddress_level5() {
        return mAddress_level5;
    }

    public String getOwner_name() {
        return mOwner_name;
    }

    public String getR_info_id() {
        return mR_info_id;
    }

    public String getR_info_title() {
        return mR_info_title;
    }

    public String getR_info_description() {
        return mR_info_description;
    }

    @Override
    public String toString() {
        return "HPHouseDetail{" +
                "mandates=" + mandates +
                ", facilitys=" + facilitys +
                ", picLists=" + picLists +
                ", mId=" + mId +
                ", mName='" + mName + '\'' +
                ", mIntro='" + mIntro + '\'' +
                ", mOwner_id=" + mOwner_id +
                ", mRoom_type=" + mRoom_type +
                ", mStatus=" + mStatus +
                ", mHotel_type=" + mHotel_type +
                ", mLng='" + mLng + '\'' +
                ", mLat='" + mLat + '\'' +
                ", mAddress_level1='" + mAddress_level1 + '\'' +
                ", mAddress_level2='" + mAddress_level2 + '\'' +
                ", mAddress_level3='" + mAddress_level3 + '\'' +
                ", mAddress_level4='" + mAddress_level4 + '\'' +
                ", mRoom_inner_intro='" + mRoom_inner_intro + '\'' +
                ", mTraffic_intro='" + mTraffic_intro + '\'' +
                ", mAround_village_intro='" + mAround_village_intro + '\'' +
                ", mUse_rule='" + mUse_rule + '\'' +
                ", mHid=" + mHid +
                ", mIntro1=" + mIntro1 +
                ", mPrice_type=" + mPrice_type +
                ", mPrice=" + mPrice +
                ", mDeposit=" + mDeposit +
                ", mS_num=" + mS_num +
                ", mBed_num=" + mBed_num +
                ", mTags=" + mTags +
                ", mBed_size=" + mBed_size +
                ", mRoom_size=" + mRoom_size +
                ", mSex_limit=" + mSex_limit +
                ", mMax_person=" + mMax_person +
                ", mS_sort=" + mS_sort +
                ", mBuy_type=" + mBuy_type +
                ", mMin_book_days=" + mMin_book_days +
                ", mMax_book_days=" + mMax_book_days +
                ", mLast_update=" + mLast_update +
                ", mCurrent_status=" + mCurrent_status +
                ", mMCurrent_status=" + mMCurrent_status +
                ", mCheck_time='" + mCheck_time + '\'' +
                ", mOut_time='" + mOut_time + '\'' +
                ", mRefund=" + mRefund +
                ", mBedroom_num=" + mBedroom_num +
                ", mBathroom_num=" + mBathroom_num +
                ", mHotel_type_name='" + mHotel_type_name + '\'' +
                ", mRoom_type_name='" + mRoom_type_name + '\'' +
                ", mAddress_level5=" + mAddress_level5 +
                ", mOwner_name='" + mOwner_name + '\'' +
                ", mR_info_id='" + mR_info_id + '\'' +
                ", mR_info_title='" + mR_info_title + '\'' +
                ", mR_info_description='" + mR_info_description + '\'' +
                '}';
    }
}
